<template>
  <transition>
    <div class="insurance-application">
    <div class="app-main">
      <ul class="module-step">
        <li class="item">
          <span class="count">1</span>
          <span class="title">车辆信息</span>
        </li>
        <li class="item ">
          <span class="count">2</span>
          <span class="title">投保方案</span>
        </li>
        <li class="item">
          <span class="count">3</span>
          <span class="title">报价信息</span>
        </li>
        <li class="item active">
          <span class="count">4</span>
          <span class="title">申请核保</span>
        </li>
      </ul>
      <div class="module-info">
        <div class="info-title">车主信息</div>
          <mt-field label="姓名" placeholder="请输入姓名" v-model="post.name"></mt-field>
          <mt-field label="手机号" placeholder="请输入手机号" v-model="post.phone"></mt-field>
          <mt-cell
            title="证件类型" class="mint-field mint-field-select">
            <select v-model="post.codeType" class="select-operator">
              <option v-for="item in codeTypeList" :value="item.name">{{item.name}}</option>
            </select>
          </mt-cell>
          <mt-field label="证件号码" placeholder="请输入证件号码" v-model="post.code"></mt-field>
      </div>
      <div class="module-info">
        <div class="info-title">投保人信息<mt-switch class="module-switch-tips" v-model="isCarOwner">同车主信息</mt-switch></div>
        <mt-field label="姓名" placeholder="请输入姓名" v-model="post.policyHolderName"></mt-field>
        <mt-field label="手机号" placeholder="请输入手机号" v-model="post.policyHolderPhone"></mt-field>
        <mt-cell
          title="证件类型" class="mint-field mint-field-select">
          <select v-model="post.policyHolderCodeType" class="select-operator">
            <option v-for="item in codeTypeList" :value="item.name">{{item.name}}</option>
          </select>
        </mt-cell>
        <mt-field label="证件号码" placeholder="请输入证件号码" v-model="post.policyHolderCode"></mt-field>
      </div>
      <div class="module-info">
        <div class="info-title">保单接收人</div>
        <mt-cell
          title="保单类型" class="mint-field mint-field-select">
          <select v-model="post.baodanType" class="select-operator">
            <option value="纸质保单">纸质保单</option>
            <option value="电子保单">电子保单</option>
          </select>
        </mt-cell>
        <mt-field label="联系人" placeholder="请输入联系人" v-model="post.phone"></mt-field>
        <mt-field label="手机号" placeholder="请输入手机号" v-model="post.phone"></mt-field>
        <mt-field label="联系地址" placeholder="请输入联系地址" v-model="post.phone"></mt-field>
      </div>
      <div class="button-content-bottom">
      <mt-button type="primary" @click.native="handleToNext">立即支付</mt-button>
      </div>
      </div>
    </div>
  </transition>
</template>

<script>
  import { Switch} from 'mint-ui';
export default {
  data () {
    return {
      isCarOwner:false,
      codeTypeList:[
        {
          name:'身份证'
        },{
          name:'回乡证'
        },{
          name:'港澳通行证'
        },],
      post:{
        codeType:'身份证',
        policyHolderCodeType:'身份证',
        baodanType:'纸质保单',
      }
    }
  },
  computed:{
  },
  watch:{
    isCarOwner(val){
      if(val==true){
        this.post.policyHolderName=this.post.name
        this.post.policyHolderPhone=this.post.phone
        this.post.policyHolderCodeType=this.post.codeType
        this.post.policyHolderCode=this.post.code
      }
    }
  },
  mounted(){

  },
  methods:{
    handleToNext(){

      this.$router.push({path:'/insurance-order-details'})
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style>
  .insurance-application .app-main{
    padding:0 0 62px;
  }
  .insurance-application .module-step{
    background: #fff;
    display: flex;
    padding:20px 0;
  }
  .insurance-application .module-step .item{
    position: relative;
    width: 25%;
    text-align: center;
  }
  .insurance-application .module-step .item:before{
    background: #007EE5;
    position: absolute;
    top:8px;
    left: 0;
    content: '';
    width: 50%;
    height: 1px;
  }
  .insurance-application .module-step .item:after{
    background: #007EE5;
    position: absolute;
    top:8px;
    content: '';
    width: 50%;
    height: 1px;
  }
  .insurance-application .module-step .item:first-child:before,.insurance-application .module-step .item:last-child:after{
    background: #fff;
  }
  .insurance-application .module-step .item.active .count{
    background: #007EE5;
    color: #fff;
  }
  .insurance-application .module-step .count{
    background: #fff;
    position: relative;
    z-index: 10;
    display: inline-block;
    width: 17px;
    height: 17px;
    line-height: 17px;
    border-radius: 50%;
    border: 1px solid #007EE5;
    color: #007EE5;
    font-size: 13px;
  }
  .insurance-application .module-step .title{
    display: block;
    padding:4px 0 0;
    color: #007EE5;
  }
  .insurance-application .button-content-bottom{
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    display: flex;
    box-shadow: 0px -6px 4px 0px rgba(0, 0, 0, 0.03);
  }
  .insurance-application .button-content-bottom .mint-button{
    display: flex;
    flex: 1;
    border-radius: 0;
    justify-content: center;
    font-size: 16px;
    box-shadow: none;
    height: 50px;

  }
  .insurance-application .module-info .info-title{
    padding:12px 14px;
    color: #333;
    font-size: 13px;
  }
  .insurance-application .module-info .info-title:before{
    background: #007EE5;
    position: relative;
    top: -1px;
    display: inline-block;
    vertical-align: middle;
    width: 1px;
    height: 12px;
    content: '';
    margin-right: 6px;
  }
  .insurance-application .select-operator{
    width: 100%;
    min-height:32px;
    border:none;
    outline:none;
    font-size: 16px;
    color: #666;
    background: none;
    text-align: right;
    /*direction: rtl;*/
  }
  .insurance-application .module-switch-tips{
    float: right;
    position: relative;
    top: -2px;
  }
  .insurance-application .module-switch-tips .mint-switch-core{
    width: 38px;
    height: 25px;
  }
  .insurance-application .module-switch-tips .mint-switch-core:before{
    width: 36px;
    height: 23px;
  }
  .insurance-application .module-switch-tips .mint-switch-core:after{
    width:20px;
    height: 23px;
  }
  .insurance-application .module-switch-tips .mint-switch-input:checked+.mint-switch-core:after {
    -webkit-transform: translateX(16px);
    transform: translateX(16px);
  }
</style>
